<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"+ request.getServerName() + ":" + request.getServerPort()+ path + "/";
%>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<base href="<%=basePath%>">
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
<meta content="telephone=no,email=no" name="format-detection">
<meta name="wap-font-scale" content="no">
<title>添加入住人</title>
    <!-- 公用样式css -->
    <link href="css/base.css" rel="stylesheet" type="text/css" />
    <!-- 界面引入css -->
    <link href="css/interests-member.css" rel="stylesheet" type="text/css" />
    <!-- ui框架引入css -->
    <link href="css/weui.min.css" rel="stylesheet" type="text/css" />
    <link href="css/jquery-weui.min.css" rel="stylesheet" type="text/css" />
    <link href="css/bootstrap-switch.css" rel="stylesheet" type="text/css" />
</head>

<body>
	<header class="header">
       <%-- <a href="<%=basePath%>member/getMemCheckInList" class="header-left"><img class="img-home" src="images/return.png" /></a>--%>
        <div class="header-center word5 "><a class="header-arrow">添加入住人</a></div>
        <div class="header-right wor-colour6" onclick="_backList();return false;">关闭</div>
    </header>
<div class="main bot44" style="background:#fff;">
    <form id="form" action="">
	<div style="height:1px; background:#eee;"></div>
	<ul class="adjun-list">
    	<li class="adjun-left">入住人</li>
        <li class="adjun-right"><input id="contactName" name="contactName" required type="text" class="adjun-input wor-colour1" placeholder="请输入入住人名称" /></li>
    </ul>
    <ul class="adjun-list">
    	<li class="adjun-left">联系电话</li>
        <li class="adjun-right"><input id="contactPhone" name="contactPhone" required number="true" type="text" class="adjun-input wor-colour1" placeholder="请输入入住人手机号" /></li>
    </ul>
    <ul style="padding:15px;" >
        <li class="word4"><span>设为默认</span>
            <input name="status" type="checkbox" data-size="small">
            <input id="defaultSign" name="defaultSign" type="hidden" value="false">
        </li>
    </ul>
        <input type="hidden" name="memKey" id="memKey" value="${memKey}">
        <input type="hidden" name="checkedMsg" id="checkedMsg" value="${checkedMsg}">
        <input type="hidden" name="type" id="type" value="${type}">
    <div class="pay-button-all"><a class="pay-button" onclick="sumbitForm();return false;">保存</a></div>
    </form>
</div>
    <script type="text/javascript" src="js/jquery/jquery.js" ></script>
    <script type="text/javascript" src="js/jquery/swiper.js"></script>
    <script type="text/javascript" src="js/jquery/city-picker.js"></script>
    <script type="text/javascript" src="js/jquery/weui.js"></script>
    <script type="text/javascript" src="js/bootstrap-switch.js"></script>
    <script type="text/javascript" src="js/jquery.validate.js"></script>
    <script type="text/javascript" src="js/messages_zh.min.js"></script>
    <script type="text/javascript" src="js/artDialog/artDialog.source.js?skin=simple"></script>
    <script type="text/javascript" src="js/artDialog/plugins/iframeTools.source.js"></script>
<script type="text/javascript">
    $(function() {// 初始化内容
        $('[name="status"]').bootstrapSwitch({
            onColor:"success",
            offColor:"default",
            size:"small",
            onSwitchChange:function(event,state){
                if(state==true){
                    $("#defaultSign").val("true");
                }else{
                    $("#defaultSign").val("false");
                }
            }
        });

    });


    function sumbitForm() {
        if($("#form").valid()){
            var dataJson = $("#form").serialize();
            $.ajax({
                url:"<%=basePath%>member/addCheckInSubmit",
                type:"post",
                data:dataJson,
                success:function(data){
                    if(data.stateID==0&&data.businessState==0){
                        art.dialog.tips('操作成功');
                        window.location.replace('<%=basePath%>home/occupant?memKey='+$("#memKey").val()+'&checkedMsg='+$("#checkedMsg").val()+'&type='+$("#type").val());
                    }else if(data.stateID==4){
                        window.location.replace('<%=basePath%>home/gotoRegister');//注册页面
                    }else {
                        art.dialog.tips(data.msgInfo);
                    }
                },
                error:function(e){
                    art.dialog.tips('操作异常');
                }
            });
        }
    }
    //返回列表页
    function  _backList() {
        window.location.replace('<%=basePath%>home/occupant?memKey='+$("#memKey").val()+'&checkedMsg='+$("#checkedMsg").val()+'&type='+$("#type").val());
    }

</script>
</body>
</html>
